package com.ctsi.ftp.util;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;

import java.io.IOException;

/**
 * Created by ye on 2016/3/25.
 */
public class DirFilter implements PathFilter {
    @Override
    public boolean accept(Path path) {
        try {
             //SXS:add to filt the _tmp directory************************
             if(path.getName().toString().contains("_tmp"))  return false;
             if(HdfsUtil.isHdfsDirectory(path) && !HdfsUtil.isHdfsDirEmpty(path))
                 return true;
        } catch (IOException e) {
            e.printStackTrace();
            return true;
        }
        return false;
    }
}
